In list mode, set the background color of the cell view to the base color
authorMatthias Clasen <maclas@gmx.de>
Thu, 4 Mar 2004 20:43:41 +0000 (20:43 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 4 Mar 2004 20:43:41 +0000 (20:43 +0000)
Thu Mar  4 21:45:43 2004  Matthias Clasen  <maclas@gmx.de>

* gtk/gtkcombobox.c: In list mode, set the background color
of the cell view to the base color of the style, instead of
hardwiring white. (#136158)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkcombobox.c

index a3b6b982f2b92408a11c0943940d10f6dffa9cb7..6b58f0d512df80163c4508dd0d9f59ea44fd2165 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Mar  4 21:45:43 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c: In list mode, set the background color 
+       of the cell view to the base color of the style, instead of
+       hardwiring white. (#136158)
+
 Thu Mar  4 01:32:19 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkpathbar.c (gtk_path_bar_set_path): Modified patch from
index a3b6b982f2b92408a11c0943940d10f6dffa9cb7..6b58f0d512df80163c4508dd0d9f59ea44fd2165 100644 (file)
@@ -1,3 +1,9 @@
+Thu Mar  4 21:45:43 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c: In list mode, set the background color 
+       of the cell view to the base color of the style, instead of
+       hardwiring white. (#136158)
+
 Thu Mar  4 01:32:19 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkpathbar.c (gtk_path_bar_set_path): Modified patch from
index a3b6b982f2b92408a11c0943940d10f6dffa9cb7..6b58f0d512df80163c4508dd0d9f59ea44fd2165 100644 (file)
@@ -1,3 +1,9 @@
+Thu Mar  4 21:45:43 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c: In list mode, set the background color 
+       of the cell view to the base color of the style, instead of
+       hardwiring white. (#136158)
+
 Thu Mar  4 01:32:19 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkpathbar.c (gtk_path_bar_set_path): Modified patch from
index a3b6b982f2b92408a11c0943940d10f6dffa9cb7..6b58f0d512df80163c4508dd0d9f59ea44fd2165 100644 (file)
@@ -1,3 +1,9 @@
+Thu Mar  4 21:45:43 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c: In list mode, set the background color 
+       of the cell view to the base color of the style, instead of
+       hardwiring white. (#136158)
+
 Thu Mar  4 01:32:19 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkpathbar.c (gtk_path_bar_set_path): Modified patch from
index a3b6b982f2b92408a11c0943940d10f6dffa9cb7..6b58f0d512df80163c4508dd0d9f59ea44fd2165 100644 (file)
@@ -1,3 +1,9 @@
+Thu Mar  4 21:45:43 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c: In list mode, set the background color 
+       of the cell view to the base color of the style, instead of
+       hardwiring white. (#136158)
+
 Thu Mar  4 01:32:19 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkpathbar.c (gtk_path_bar_set_path): Modified patch from
index c5a5c630e05c738467ce4809546910ef7bd10d79..6c349378aaf4332e9eba0a10f7c79025911f261e 100644 (file)
@@ -190,6 +190,8 @@ static void     gtk_combo_box_get_property         (GObject         *object,
                                                     GValue          *value,
                                                     GParamSpec      *spec);
 
+static void     gtk_combo_box_state_changed        (GtkWidget        *widget,
+                                                   GtkStateType      previous);
 static void     gtk_combo_box_style_set            (GtkWidget       *widget,
                                                     GtkStyle        *previous);
 static void     gtk_combo_box_button_toggled       (GtkWidget       *widget,
@@ -414,6 +416,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
   widget_class->scroll_event = gtk_combo_box_scroll_event;
   widget_class->mnemonic_activate = gtk_combo_box_mnemonic_activate;
   widget_class->style_set = gtk_combo_box_style_set;
+  widget_class->state_changed = gtk_combo_box_state_changed;
 
   gtk_object_class = (GtkObjectClass *)klass;
   gtk_object_class->destroy = gtk_combo_box_destroy;
@@ -594,6 +597,22 @@ gtk_combo_box_get_property (GObject    *object,
     }
 }
 
+static void
+gtk_combo_box_state_changed (GtkWidget    *widget,
+                            GtkStateType  previous)
+{
+  GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
+
+  if (GTK_WIDGET_REALIZED (widget))
+    {
+      if (combo_box->priv->tree_view && combo_box->priv->cell_view)
+       gtk_cell_view_set_background_color (GTK_CELL_VIEW (combo_box->priv->cell_view), 
+                                           &widget->style->base[GTK_WIDGET_STATE (widget)]);
+    }
+
+  gtk_widget_queue_draw (widget);
+}
+
 static void
 gtk_combo_box_style_set (GtkWidget *widget,
                          GtkStyle  *previous)
@@ -602,7 +621,7 @@ gtk_combo_box_style_set (GtkWidget *widget,
   GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
 
   gtk_widget_queue_resize (widget);
-
+  
   /* if wrap_width > 0, then we are in grid-mode and forced to use
    * unix style
    */
@@ -634,6 +653,11 @@ gtk_combo_box_style_set (GtkWidget *widget,
       if (!GTK_IS_MENU (combo_box->priv->popup_widget))
        gtk_combo_box_menu_setup (combo_box, TRUE);
     }
+
+  if (combo_box->priv->tree_view && combo_box->priv->cell_view)
+    gtk_cell_view_set_background_color (GTK_CELL_VIEW (combo_box->priv->cell_view), 
+                                       &widget->style->base[GTK_WIDGET_STATE (widget)]);
+
 }
 
 static void
@@ -2113,10 +2137,8 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
       gtk_frame_set_shadow_type (GTK_FRAME (combo_box->priv->cell_view_frame),
                                  GTK_SHADOW_IN);
 
-      g_object_set (G_OBJECT (combo_box->priv->cell_view),
-                    "background", "white",
-                    "background_set", TRUE,
-                    NULL);
+      gtk_cell_view_set_background_color (GTK_CELL_VIEW (combo_box->priv->cell_view), 
+                                         &GTK_WIDGET (combo_box)->style->base[GTK_WIDGET_STATE (combo_box)]);
 
       gtk_widget_show (combo_box->priv->cell_view_frame);
     }